﻿@model KL.Store.Web.Models.ContactListModel
@using KL.Store.Core.Domain
<table>
    <tr>
        <td>
            @using (Ajax.BeginForm("ListGet", "Contact", new { }, new AjaxOptions { UpdateTargetId = "contactList", HttpMethod = "Post", LoadingElementId = "LoadingTotal" }, new { id = "frmRefresh", name = "frmRefresh" }))
            {
                @Html.TextBoxFor(model => model.Search)
                <a class="button" onclick="$('#frmRefresh').submit()"><span>Ara</span></a>
                <div class="cart-info">
                    <div class="shop-cart">
                        <table>
                            <thead>
                                <tr>
                                    <td style="width: 40px">
                                        İşlem
                                    </td>
                                    <td>
                                        Email
                                    </td>
                                    <td>
                                        Tarih
                                    </td>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (Contact contact in Model.Contacts)
                                { 
                                    <tr>
                                        <td>
                                            <a onclick="deleteMember(@(contact.MemberId))">Sil</a>
                                        </td>
                                        <td>@contact.Email
                                        </td>
                                        <td>@contact.CreateDateStr
                                        </td>
                                    </tr>
                                }
                            </tbody>
                            <tfoot>
                                <tr>
                                    <td>
                                        Toplam
                                    </td>
                                    <td colspan="2">@(Model.Contacts.Count)
                                        Adet
                                    </td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            }
        </td>
        <td>
        </td>
    </tr>
</table>
<script type="text/javascript">
    function deleteMember(memberId) {
        $('#contactList').load('/Contact/Delete', { Search: $('#Search').val(), id: memberId });
    }
</script>
